<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>读取存储训练数据的文件。</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.fann-read-train-from-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">fann_read_train_from_file</h1>
  <p class="verinfo">(PECL fann &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">fann_read_train_from_file</span> &mdash; <span class="dc-title">读取存储训练数据的文件。</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.fann-read-train-from-file-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>fann_read_train_from_file</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   读取存储训练数据的文件。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.fann-read-train-from-file-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">filename</code></dt>

    <dd>

     <p class="para">
      输入文件的格式如下:
     </p>
     <div class="example-contents">
<div class="txtcode"><pre class="txtcode">num_train_data num_input num_output
inputdata seperated by space
outputdata seperated by space

.
.
.

inputdata seperated by space
outputdata seperated by space</pre>
</div>
     </div>

    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.fann-read-train-from-file-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para"> Returns a train data <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> on success, or <strong><code>FALSE</code></strong> on error.</p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.fann-read-train-from-file-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4508">
    <p><strong>Example #1 <span class="methodname"><strong>fann_read_train_from_file()</strong></span> 函数的使用范例：</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$train_data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fann_read_train_from_file</span><span style="color: #007700">(</span><span style="color: #DD0000">"xor.data"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$train_data</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Do&nbsp;something&nbsp;with&nbsp;$train_data&nbsp;for&nbsp;XOR&nbsp;function<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>xor.data 文件的内容：</p></div>
    <div class="example-contents">
<div class="txtcode"><pre class="txtcode">4 2 1
-1 -1
-1
-1 1
1
1 -1
1
1 1
-1</pre>
</div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.fann-read-train-from-file-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="fann_train_on_data.html" class="function" rel="rdfs-seeAlso">fann_train_on_data()</a> - 在整个数据集上训练一段时间。</span></li>
    <li class="member"><span class="function"><a href="fann_destroy_train.html" class="function" rel="rdfs-seeAlso">fann_destroy_train()</a> - 销毁训练数据。</span></li>
    <li class="member"><span class="function"><a href="fann_save_train.html" class="function" rel="rdfs-seeAlso">fann_save_train()</a> - 将训练结构体保存至文件。</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>